package com.gitee.wsl.mathematics.vector.ext

import com.gitee.wsl.mathematics.vector.Vector
import com.gitee.wsl.mathematics.vector.vec2.Vector2
import com.gitee.wsl.mathematics.vector.vec3.Vector3
import com.gitee.wsl.mathematics.vector.vec4.Vector4


operator fun <T:Number,V: Vector<T, V>> Number.minus(vec: Vector<T, V>) = vec.minusBy(this)

//operator fun<T:Number,K: Vector<T, K>> Vector<T, K>.minus(other: Number) = create(proxy.map{ i ->  i - other  })

operator fun<T:Number,K: Vector2<T, K>> Vector2<T, K>.minus(other: Vector2<T, *>):K = create(x - other.x, y - other.y)
operator fun<T:Number,K: Vector3<T, K>> Vector2<T, *>.minus(other: K) = other.create(x - other.x, y - other.y, other.z)
operator fun<T:Number,K: Vector4<T, K>> Vector2<T, *>.minus(other: K) = other.create(x - other.x, y - other.y, other.z, other.w)

operator fun<T:Number,V: Vector3<T, V>> Vector3<T, V>.minus(other: Vector2<T, *>) = create(x - other.x, y - other.y, z)
operator fun<T:Number,V: Vector3<T, V>> Vector3<T, V>.minus(other: Vector3<T, *>) = create(x - other.x, y - other.y, z - other.z)
operator fun<T:Number,K: Vector4<T, K>> Vector3<T, *>.minus(other: K)             = other.create(x - other.x, y - other.y, z - other.z, other.w)

operator fun<T:Number,V: Vector4<T, V>> Vector4<T, V>.minus(other: Vector2<T, *>) = create(x - other.x, y - other.y, z, w)
operator fun<T:Number,V: Vector4<T, V>> Vector4<T, V>.minus(other: Vector3<T, *>) = create(x - other.x, y - other.y, z - other.z, w)
operator fun<T:Number,V: Vector4<T, V>> Vector4<T, V>.minus(other: Vector4<T, *>) = create(x - other.x, y - other.y, z - other.z, w - other.w)
